package com.xidian.zhiancloud.controller;

import com.aliyuncs.exceptions.ClientException;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.util.tools.AliyunSmsUtils;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 测试接口
 *
 * @Author: Summerless
 * @Date: 2020/11/5 15:22
 */
@RestController
@RequestMapping("/test")
public class IndexController {
    /**
     * get方法测试
     *
     * @return
     */
    @GetMapping("/get")
    public ResultDTO<Boolean> get() {
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }

    /**
     * post方法测试
     *
     * @return
     */
    @PostMapping("/post")
    public ResultDTO<Boolean> post() {
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }

    /**
     * delete方法测试
     *
     * @return
     */
    @DeleteMapping("/delete")
    public ResultDTO<Boolean> delete() {
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }

    /**
     * patch方法测试
     *
     * @return
     */
    @PatchMapping("/patch")
    public ResultDTO<Boolean> patch() {
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    
    @GetMapping("/sendMsg")
    public ResultDTO<Boolean> sendMsg() throws ClientException {
    	String resutl = AliyunSmsUtils.sendCode("xxx","1");
    	System.out.println(resutl+"-----------");
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
        
        
    } 
    
    @GetMapping("/getMsg")
    public ResultDTO<Boolean> getMsg() {
    	String code = AliyunSmsUtils.checkCode("xx");
    	System.out.println(code+"--------");
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    } 
    
    
}
